package com.qingzhuge.utils;

import lombok.Data;

import java.util.List;

/**
 * @author : zero.xiao
 * @description :
 * @date : 2018/10/23 0023 上午 11:02
 * @modified :
 * @since :
 */
@Data
public class PageUtil<E> {
    private int total = 0;
    private int size = 10;
    private int page = 0;
    private int pageTotal = 0;
    private boolean first = false;
    private boolean last = false;
    private List<E> content;

    public static <E> PageUtil<E> of(int total,
                                     int size,
                                     int page,
                                     int pageTotal,
                                     boolean first,
                                     boolean last,
                                     List<E> content) {
        PageUtil<E> p = new PageUtil<>();
        p.setContent(content);
        p.setTotal(total);
        p.setPage(page);
        p.setFirst(first);
        p.setLast(last);
        p.setPageTotal(pageTotal);
        p.setSize(size);
        return p;
    }
}
